<!--
 * @Author: 严晗 823841034@qq.com
 * @Date: 2023-10-08 14:14:18
 * @LastEditors: 严晗 823841034@qq.com
 * @LastEditTime: 2023-10-13 11:27:53
 * @FilePath: /yike-admin/Users/yanhan/vite-project/src/pages/index.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
	<div>
		首页
		<el-button @click="handleLogout">退出登录</el-button>
	</div>
</template>
<script setup>
import { toast, showModel } from '~/composables/utils'
import { useRouter } from 'vue-router'
import { useStore } from 'vuex'

const router = useRouter()
const store = useStore()

const handleLogout = () => {
	showModel('退出系统, 是否继续?').then(() => {
		store.dispatch('logout').finally(() => {
			// 提示
			toast('退出登录成功')
			// 跳转回登录页
			router.push('/login')
		})
	})
}
</script>
